void context_switch(struct vcpu *prev, struct vcpu *next)
{
uint64_t spsr;
+ uint64_t pta;
local_irq_save(spsr);
if(VMX_DOMAIN(prev)){
}
context_switch_count++;
switch_to(prev,next,prev);
- if(VMX_DOMAIN(current)){
- vtm_domain_in(current);
- }
+// if(VMX_DOMAIN(current)){
+// vtm_domain_in(current);
+// }
// leave this debug for now: it acts as a heartbeat when more than
// one domain is active
}
if (VMX_DOMAIN(current)){
+ vtm_domain_in(current);
vmx_load_all_rr(current);
}else{
- extern char ia64_ivt;
- ia64_set_iva(&ia64_ivt);
- ia64_set_pta(VHPT_ADDR | (1 << 8) | (VHPT_SIZE_LOG2 << 2) |
- VHPT_ENABLED);
+ extern char ia64_ivt;
+ ia64_set_iva(&ia64_ivt);
if (!is_idle_domain(current->domain)) {
+ ia64_set_pta(VHPT_ADDR | (1 << 8) | (VHPT_SIZE_LOG2 << 2) |
+ VHPT_ENABLED);
load_region_regs(current);
vcpu_load_kernel_regs(current);
- if (vcpu_timer_expired(current)) vcpu_pend_timer(current);
- }
- if (vcpu_timer_expired(current)) vcpu_pend_timer(current);
+ if (vcpu_timer_expired(current))
+ vcpu_pend_timer(current);
+ }else {
+ /* When switching to idle domain, only need to disable vhpt
+ * walker. Then all accesses happen within idle context will
+ * be handled by TR mapping and identity mapping.
+ */
+ pta = ia64_get_pta();
+ ia64_set_pta(pta & ~VHPT_ENABLED);
+ }
}
local_irq_restore(spsr);